<template>
	<el-dialog :close-on-click-modal="false" title="详细" :visible.sync="show" v-if="show" width="45%">
		<el-form ref="form" :model="request.data" :inline="true" label-width="80px">
			<el-row>
				<el-col :span="12">
					<el-form-item label="操作时间"><el-input v-model="request.data.optime" autocomplete="off"></el-input></el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="日志类型">
						<el-select v-model="request.data.type" placeholder="请选择" disabled>
							<el-option label="系统日志" :value="1"></el-option>
							<el-option label="错误日志" :value="2"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="模块"><el-input v-model="request.data.module" autocomplete="off"></el-input></el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="操作"><el-input v-model="request.data.operation" autocomplete="off"></el-input></el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="用户名"><el-input v-model="request.data.uname" autocomplete="off"></el-input></el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="ip"><el-input v-model="request.data.ip" autocomplete="off"></el-input></el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="用户操作浏览器" label-width="130px"><el-input v-model="request.data.useragent" autocomplete="off"></el-input></el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="uri"><el-input v-model="request.data.uri" autocomplete="off"></el-input></el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="参数"><el-input type="textarea" v-model="request.data.content" autocomplete="off"></el-input></el-form-item>
				</el-col>
			</el-row>
		</el-form>
	</el-dialog>
</template>

<script>
import utils from 'util/utils.js';
import validate from 'util/validate.js';
import api from 'api/system/loginfo/loginfo.js';
export default {
	name: 'edit',
	data() {
		return {
			show: this.isDisplay,
			request: utils.newRequest()
		};
	},
	props: {
		isDisplay: {
			type: Boolean,
			default() {
				return false;
			}
		},
		parameter: {
			type: Array | Object,
			default() {
				return {};
			}
		}
	},
	methods: {
		init() {
			this.request = utils.newRequest();
			this.request.param.id = this.parameter.id;
			api.detail(this.request, response => {
				this.request.data = response.data;
			});
		}
	},
	watch: {
		isDisplay(val) {
			this.show = val;
			if (val) {
				this.init();
			}
		},
		show(val) {
			this.$emit('update:isDisplay', val);
		},
		parameter(val) {
			this.parameter = val;
		}
	}
};
</script>

<style lang="scss">
@import '~common/custom/css/common.scss';
</style>
